package com.xyht.sca_s.student_manage_system.modules.qr.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.qr.entity.req.SmsQrReq;
import com.xyht.sca_s.student_manage_system.modules.qr.service.SmsQrService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 二维码管理 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2023-03-22
 */
@RestController
@RequestMapping("/qr")
@SecretBody
public class SmsQrController {
    @Autowired
    private SmsQrService smsQrService;

    @ApiModelProperty(value = "二维码添加")
    @PostMapping("/add")
    public ResponseResult addQr(@RequestBody SmsQrReq smsQrReq) {
        return smsQrService.addQr(smsQrReq);
    }

    @ApiModelProperty(value = "二维码修改")
    @PostMapping("/update")
    public ResponseResult updateQr(@RequestBody SmsQrReq smsQrReq) {
        return smsQrService.updateQr(smsQrReq);
    }

    @ApiModelProperty(value = "二维码删除")
    @PostMapping("/delete")
    public ResponseResult deleteQr(@RequestBody SmsQrReq smsQrReq) {
        return smsQrService.deleteQr(smsQrReq);
    }

    @ApiModelProperty(value = "二维码列表")
    @GetMapping("/list")
    public ResponseResult deleteQr(@RequestParam(value = "qr_id",required = false) String qr_id,
                                   @RequestParam(value = "qr_type",required = false) Integer qr_type,
                                   @RequestParam(value = "search_str",required = false) String search_str,
                                   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                   @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        return smsQrService.getQr(qr_id, qr_type, search_str, pageNum, pageSize);
    }

}

